package com.itheima.controller;


import com.itheima.pojo.Emp;
import com.itheima.pojo.LoginInfo;
import com.itheima.pojo.Result;
import com.itheima.service.LoginService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/login")
public class LoginController {
    @Autowired
    private LoginService loginService;
    @PostMapping
    public Result login(@RequestBody Emp emp){
        LoginInfo loginInfo=loginService.getLogin(emp);
        if(loginInfo == null){
            return Result.error("登录失败！");
        }
        return Result.success(loginInfo);
    }
}
